package com.mall.goods.feign;

import com.mall.cart.model.Cart;
import com.mall.goods.model.Sku;
import com.mall.common.util.RespResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Darren
 * @date 2022-08-19 10:08
 * Description：595314112@qq.com
 */
@FeignClient(value = "mall-goods") // 这里对应的是服务名字
@RequestMapping("/sku")
public interface SkuFeign {
    @GetMapping("/typeSkuItems")
    @ApiOperation(value = "根据推广id查询Sku列表")
    RespResult<List<Sku>> typeSkuItems(@RequestParam("type") Integer type);

    @DeleteMapping("/typeSkuItems")
    @ApiOperation(value = "根据推广id删除Sku列表缓存")
    RespResult delTypeSkuItems(@RequestParam("type") Integer type);

    @PutMapping("/typeSkuItems")
    @ApiOperation(value = "根据推广id修改Sku列表缓存")
    RespResult updateTypeSkuItems(@RequestParam("type") Integer type);

    @GetMapping("/{id}")
    @ApiOperation(value = "根据id查询")
    RespResult<Sku> getById(@PathVariable("id") String id);

    @PostMapping(value = "/reduceSkuNum")
    @ApiOperation(value = "减少商品库存")
    RespResult reduceSkuNum(@RequestBody List<Cart> carts);
}
